//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    imgUrlstop:[],//第一个轮播
    recommend:[],
    imgPath:app.globalData.imgPath,
    indicatorDots:true,
    autoplay:true,
    interval:3000,
    midswiper:[],//第二个轮播
    botad:[],//底部广告
    section1:null,//代理区
    section2:null,//会员消费专区
  },
  //事件处理函数
 
  onLoad: function () {
    let self=this;
    wx.request({
      url: app.globalData.reqPath+'shop/Banners',
      header:{
        'authorization':app.globalData.authorization
      },
      success:function({data}){ 
        let list=data.data;       
        self.setData({ imgUrlstop: list.top, midswiper: list.mid})
        if (list.bottom){
          self.setData({ botad: list.bottom})
        }
      }
    })
  
    wx.request({
      url:app.globalData.reqPath+'shop/GoodsCategories',
      data:{
        special:1
      },
      header: {
        'authorization': app.globalData.authorization
      },
      success:function(res){
        if (res.data.code==200){
          let recommend = res.data.data;
          self.setData({ section1: recommend[0], section2: recommend[1]})
        }
         
      }
    })
  

  },


})
